﻿@using Models;
@model scorelog
@{
    ViewBag.Title = "打分";
    Layout = "~/Areas/Mobile/Views/Shared/_Layout.cshtml";
}
<div class="header">
    <img src="~/Areas/Mobile/HTML/images/banner-1.png" />
</div>
<div class="player-info">
    <p>请为 <span class="player-name">@(ViewBag.PlayerSort)号</span> 选手打分</p>
    <img class="doctor-img" src="~/Areas/Mobile/HTML/images/doctor.png" />
</div>
<form class="player-form" id="player-form">
    @Html.HiddenFor(o => o.playerid)
    <input type="number" name="Score" id="Score" value="" placeholder="输入分数" />
    <p>温馨提示，请输入80至100之间的数值,80分以下为无效分值</p>
    <button class="btn-block" type="button" onclick="SaveScore(this)">提交</button>

</form>
<script>
    var lock = false;
    function SaveScore(target) {
        if (lock) {
            return false;
        }
        else {
            lock = true;
            var score = parseInt($("#Score").val());
            if (isNaN(score) || score < 80 || score > 100) {
                mui.alert("请输入 80-100 之间的分数！");
                lock = false;
                return false;
            }
            mui.confirm("<span style=\"font-size:20px;font-weight:bold;color:#ffb500;\">" + score + "分</span>" + "<br />请核对评分，提交后无法进行修改", "提示", ["取消", "确认"], function (e) {
                if (e.index == 1) {
                    Loading();
                    var data = $("#player-form").serialize();
                    $.post("/mobile/survey/mark", data, function (result) {
                        lock = false;
                        CloseLoading();
                        if (result.status) {
                            mui.alert(result.data, function () {
                                window.location.href = "/mobile/survey/notopen?msg=感谢您的评分！";
                            });
                        } else {
                            mui.alert(result.errmsg);
                        }
                    });
                } else {
                    lock = false;
                }
            });
        }
    }
</script>